<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: H:/project/LibTools/src/algorithm/Algorithm.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_fbc178c12bd249518b3c0868875b8083.html">algorithm</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Algorithm.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_algorithm_8h.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef _QALGORITHM_H</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define _QALGORITHM_H</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;../tools/tools.h&quot;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160; </div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<a class="code" href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160; </div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; </div>
<div class="line"><a name="l00009"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a75d98bbb517773f8685c32b64ac89ff3">    9</a></span>&#160;<span class="keyword">inline</span> <span class="keyword">const</span> T&amp; <a class="code" href="_algorithm_8h.html#a75d98bbb517773f8685c32b64ac89ff3">qmin</a> (<span class="keyword">const</span> T&amp; a, <span class="keyword">const</span> T&amp; b) {</div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;    <span class="keywordflow">return</span> !(b&lt;a)?a:b;     <span class="comment">// or: return !comp(b,a)?a:b; for version (2)</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;}</div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;</div>
<div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a9379b0bfedc56fbe48ad3e07b67273ee">   15</a></span>&#160;<span class="keyword">inline</span> <span class="keyword">const</span> T&amp; <a class="code" href="_algorithm_8h.html#a9379b0bfedc56fbe48ad3e07b67273ee">qmax</a>(<span class="keyword">const</span> T&amp; a, <span class="keyword">const</span> T&amp; b)</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;{</div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;    <span class="keywordflow">return</span> (a&gt;b) ? a : b;</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;}</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class </span>_InIt,</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;         <span class="keyword">class </span>_OutIt,</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;         <span class="keyword">class </span>_Pr&gt; <span class="keyword">inline</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a064388cb374aaa40e69c4020a9f9e0d1">   31</a></span>&#160;_OutIt <a class="code" href="_algorithm_8h.html#a064388cb374aaa40e69c4020a9f9e0d1">copy_real</a>(_InIt _First, _InIt _Last, _OutIt _Dest, _Pr _Pred)</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;{</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    <span class="keywordflow">for</span> (; _First != _Last; ++_First){</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;        <span class="keywordflow">if</span> (_Pred(*_First))</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;            *_Dest++ = *_First;</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;        <span class="keywordflow">else</span>{</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;            <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;        }</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    }</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <span class="keywordflow">return</span> (_Dest);</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;}</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class </span>Value1,</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;         <span class="keyword">class </span>Value2&gt;</div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a06f9a9fa653c88f36445cacf0ea7ad8d">   53</a></span>&#160;<span class="keywordtype">size_t</span> <a class="code" href="_algorithm_8h.html#a06f9a9fa653c88f36445cacf0ea7ad8d">copy_seq</a>(Value1* v1, <span class="keywordtype">size_t</span> s1, <span class="keyword">const</span> Value2* v2, <span class="keywordtype">size_t</span> s2)</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;{</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    s1 = <a class="code" href="_algorithm_8h.html#a75d98bbb517773f8685c32b64ac89ff3">qmin</a>(s1, s2);</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="keywordtype">size_t</span> s = 0;</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <span class="keywordflow">for</span> (s = 0; s != s1; ++s) *v1++ = (Value1)(*v2++);</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160; </div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="keywordflow">return</span> s;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;}</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> InputIterator, <span class="keyword">class</span> Size, <span class="keyword">class</span> OutputIterator&gt;  </div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a05245b92e1ff10aff9383c2047ceaa7e">   71</a></span>&#160;OutputIterator <a class="code" href="_algorithm_8h.html#a05245b92e1ff10aff9383c2047ceaa7e">copy_n</a>(InputIterator first, Size count, OutputIterator dest)</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;{</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;    OutputIterator result = dest;</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <span class="keywordflow">for</span> ( ; count &gt; 0; --count) {</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;        *result = *first;</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        ++first;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;        ++result;</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    }</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="keywordflow">return</span> dest;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;}</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160; </div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160; </div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="keyword">template</span> &lt;<span class="keyword">class</span> Iterator, <span class="keyword">class</span> Size&gt;</div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#ac05fc8db35cd265c340f0aedf7128c29">   93</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="_algorithm_8h.html#ac05fc8db35cd265c340f0aedf7128c29">Compare</a>(Iterator first1, Size count1, Iterator first2, Size count2)</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;{</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;    <span class="keywordtype">int</span> count = <a class="code" href="_algorithm_8h.html#a75d98bbb517773f8685c32b64ac89ff3">qmin</a>(count1, count2);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; count; i++)</div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    {</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;        <span class="keywordflow">if</span>(*first1 &lt; *first2) <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;        <span class="keywordflow">else</span> <span class="keywordflow">if</span>(*first2 &lt; *first1) <span class="keywordflow">return</span> 1;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160; </div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;        ++first1;</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;        ++first2;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    }</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <span class="keywordflow">if</span>(count1 &gt; count2) <span class="keywordflow">return</span> 1;</div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="keywordflow">else</span> <span class="keywordflow">if</span>(count1 &lt; count2) <span class="keywordflow">return</span> -1;</div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160; </div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;}</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160; </div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Iterator, <span class="keyword">class</span> ValueType&gt;</div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#aedfb2bc1f87c412947f80cedcf310c0d">  118</a></span>&#160;<span class="keywordtype">size_t</span> <a class="code" href="_algorithm_8h.html#aedfb2bc1f87c412947f80cedcf310c0d">count_size</a>(Iterator first, Iterator end, <span class="keyword">const</span> ValueType&amp; EndValue)</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;{</div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="keywordtype">size_t</span> size = 0;</div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <span class="keywordflow">while</span> (first != end)</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    {</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;        <span class="keywordflow">if</span> (*first == EndValue) <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;        ++size;</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;        ++first;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    }</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160; </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <span class="keywordflow">return</span> size;</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;}</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160; </div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Iterator, <span class="keyword">class</span> ValueType&gt;</div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a75d62c31a70bdb3ae9aa621fda9d1a88">  138</a></span>&#160;<span class="keywordtype">size_t</span> <a class="code" href="_algorithm_8h.html#aedfb2bc1f87c412947f80cedcf310c0d">count_size</a>(Iterator first, <span class="keyword">const</span> ValueType&amp; EndValue)</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;{</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160;    <span class="keywordtype">size_t</span> size = 0;</div>
<div class="line"><a name="l00141"></a><span class="lineno">  141</span>&#160;    <span class="keywordflow">while</span> (*first != EndValue)</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    {</div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;        ++size;</div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;        ++first;</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    }</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160; </div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="keywordflow">return</span> size;</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;}</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160; </div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Iterator, <span class="keyword">class</span> ValueType&gt;</div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#ab5c29dc40888983dd00677929c5c3a93">  158</a></span>&#160;Iterator <a class="code" href="_algorithm_8h.html#ab5c29dc40888983dd00677929c5c3a93">find_last_of</a>(Iterator first, Iterator last, ValueType val)</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;{</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;    Iterator end = last;</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;    --last;</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;    <span class="keywordflow">for</span> (; last != first; --last)</div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;    {</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        <span class="keywordflow">if</span> (*last == val) <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    }</div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <span class="keywordflow">if</span> (*last == val) <span class="keywordflow">return</span> last;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160; </div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;    <span class="keywordflow">return</span> end;</div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160;}</div>
<div class="line"><a name="l00170"></a><span class="lineno">  170</span>&#160; </div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Iterator, <span class="keyword">class</span> ValueType&gt;</div>
<div class="line"><a name="l00179"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#aa47ac809a299b50f2a7056d5b4f0a68b">  179</a></span>&#160;Iterator <a class="code" href="_algorithm_8h.html#aa47ac809a299b50f2a7056d5b4f0a68b">find_first_not_of</a>(Iterator first, Iterator last, ValueType val)</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;{</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160;    <span class="keywordflow">for</span> (; first != last; ++first)</div>
<div class="line"><a name="l00182"></a><span class="lineno">  182</span>&#160;    {</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;        <span class="keywordflow">if</span> (*first != val) <span class="keywordflow">return</span> first;</div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;    }</div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno">  186</span>&#160;    <span class="keywordflow">return</span> last;</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;}</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160; </div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Iterator, <span class="keyword">class</span> ValueType&gt;</div>
<div class="line"><a name="l00197"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a9910c2076f304ee770bf2080307ba44f">  197</a></span>&#160;Iterator <a class="code" href="_algorithm_8h.html#a9910c2076f304ee770bf2080307ba44f">find_first_of</a>(Iterator first, Iterator last, ValueType val)</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;{</div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    <span class="keywordflow">for</span> (; first != last; ++first)</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    {</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;        <span class="keywordflow">if</span> (*first == val) <span class="keywordflow">return</span> first;</div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    }</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160; </div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    <span class="keywordflow">return</span> last;</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;}</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160; </div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Iterator, <span class="keyword">class</span> ValueType&gt;</div>
<div class="line"><a name="l00215"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#ac885ac7602a906c93bde0e7d8b2d9f38">  215</a></span>&#160;Iterator <a class="code" href="_algorithm_8h.html#ac885ac7602a906c93bde0e7d8b2d9f38">find_last_not_of</a>(Iterator first, Iterator last, ValueType val)</div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;{</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    Iterator end = last;</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;    --last;</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160;    <span class="keywordflow">for</span> (; last != first; --last)</div>
<div class="line"><a name="l00220"></a><span class="lineno">  220</span>&#160;    {</div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;        <span class="keywordflow">if</span> (*last != val) <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    }</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;    <span class="keywordflow">if</span> (*last != val) <span class="keywordflow">return</span> last;</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160; </div>
<div class="line"><a name="l00225"></a><span class="lineno">  225</span>&#160;    <span class="keywordflow">return</span> end;</div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;}</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160; </div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Cont, <span class="keyword">class</span> Value&gt;</div>
<div class="line"><a name="l00234"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#aa69d6a2300c1f391347658986741d8a8">  234</a></span>&#160;<span class="keyword">typename</span> Cont::iterator <a class="code" href="_algorithm_8h.html#aa69d6a2300c1f391347658986741d8a8">seq_erase</a>(Cont&amp; c, <span class="keyword">const</span> Value&amp; val)</div>
<div class="line"><a name="l00235"></a><span class="lineno">  235</span>&#160;{</div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;    <span class="keyword">typename</span> Cont::iterator it = c.begin();</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    <span class="keywordflow">for</span> (; it != c.end(); ++it)</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;    {</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160;        <span class="keywordflow">if</span> (*it == val) c.erase(it);</div>
<div class="line"><a name="l00240"></a><span class="lineno">  240</span>&#160;    }</div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160; </div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <span class="keywordflow">return</span> it;</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;}</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160; </div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;<span class="keyword">template</span>&lt;<span class="keyword">class</span> Itea1, <span class="keyword">class</span> Itea2&gt;</div>
<div class="line"><a name="l00253"></a><span class="lineno"><a class="line" href="_algorithm_8h.html#a3ca46c4f35fb3c7d4ab1485b137e14ff">  253</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="_algorithm_8h.html#a3ca46c4f35fb3c7d4ab1485b137e14ff">equal</a>(Itea1 f1, Itea1 l1, Itea2 f2, Itea2 l2)</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;{</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;    <span class="keywordflow">for</span> (; (f1 != l1) &amp;&amp; (f2 != l2); ++f1, ++f2) {</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160;        <span class="keywordflow">if</span> (!(*f1 == *f2)) {</div>
<div class="line"><a name="l00257"></a><span class="lineno">  257</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;        }</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    }</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    <span class="keywordflow">if</span>(f1 != l1 || f2 != l2) <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160;}</div>
<div class="line"><a name="l00263"></a><span class="lineno">  263</span>&#160; </div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;<a class="code" href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160; </div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;<span class="preprocessor">#endif</span></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="a_algorithm_8h_html_aedfb2bc1f87c412947f80cedcf310c0d"><div class="ttname"><a href="_algorithm_8h.html#aedfb2bc1f87c412947f80cedcf310c0d">count_size</a></div><div class="ttdeci">size_t count_size(Iterator first, Iterator end, const ValueType &amp;EndValue)</div><div class="ttdoc">计算一个序列的大小，当遇到结束符、或者到达end位置则停止计算</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00118">Algorithm.h:118</a></div></div>
<div class="ttc" id="atools_8h_html_a201ce692c9dca6599e5c12d00167419b"><div class="ttname"><a href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div><div class="ttdeci">#define DEF_BEG_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00036">tools.h:36</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_a05245b92e1ff10aff9383c2047ceaa7e"><div class="ttname"><a href="_algorithm_8h.html#a05245b92e1ff10aff9383c2047ceaa7e">copy_n</a></div><div class="ttdeci">OutputIterator copy_n(InputIterator first, Size count, OutputIterator dest)</div><div class="ttdoc">拷贝n个数量的内容到dest中</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00071">Algorithm.h:71</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_ab5c29dc40888983dd00677929c5c3a93"><div class="ttname"><a href="_algorithm_8h.html#ab5c29dc40888983dd00677929c5c3a93">find_last_of</a></div><div class="ttdeci">Iterator find_last_of(Iterator first, Iterator last, ValueType val)</div><div class="ttdoc">逆序查找</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00158">Algorithm.h:158</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_a3ca46c4f35fb3c7d4ab1485b137e14ff"><div class="ttname"><a href="_algorithm_8h.html#a3ca46c4f35fb3c7d4ab1485b137e14ff">equal</a></div><div class="ttdeci">bool equal(Itea1 f1, Itea1 l1, Itea2 f2, Itea2 l2)</div><div class="ttdoc">比较两个序列</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00253">Algorithm.h:253</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_a064388cb374aaa40e69c4020a9f9e0d1"><div class="ttname"><a href="_algorithm_8h.html#a064388cb374aaa40e69c4020a9f9e0d1">copy_real</a></div><div class="ttdeci">_OutIt copy_real(_InIt _First, _InIt _Last, _OutIt _Dest, _Pr _Pred)</div><div class="ttdoc">只有当条件为真时才拷贝</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00031">Algorithm.h:31</a></div></div>
<div class="ttc" id="atools_8h_html_ac909db71799bb22cb7d636a34cd785e4"><div class="ttname"><a href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div><div class="ttdeci">#define DEF_END_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00038">tools.h:38</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_ac885ac7602a906c93bde0e7d8b2d9f38"><div class="ttname"><a href="_algorithm_8h.html#ac885ac7602a906c93bde0e7d8b2d9f38">find_last_not_of</a></div><div class="ttdeci">Iterator find_last_not_of(Iterator first, Iterator last, ValueType val)</div><div class="ttdoc">逆向查找第一个不为val的字符所在位置</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00215">Algorithm.h:215</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_ac05fc8db35cd265c340f0aedf7128c29"><div class="ttname"><a href="_algorithm_8h.html#ac05fc8db35cd265c340f0aedf7128c29">Compare</a></div><div class="ttdeci">int Compare(Iterator first1, Size count1, Iterator first2, Size count2)</div><div class="ttdoc">比较两个序列</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00093">Algorithm.h:93</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_a9910c2076f304ee770bf2080307ba44f"><div class="ttname"><a href="_algorithm_8h.html#a9910c2076f304ee770bf2080307ba44f">find_first_of</a></div><div class="ttdeci">Iterator find_first_of(Iterator first, Iterator last, ValueType val)</div><div class="ttdoc">查找第一个为val的字符所在位置</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00197">Algorithm.h:197</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_a75d98bbb517773f8685c32b64ac89ff3"><div class="ttname"><a href="_algorithm_8h.html#a75d98bbb517773f8685c32b64ac89ff3">qmin</a></div><div class="ttdeci">const DEF_BEG_LIBTOOLS T &amp; qmin(const T &amp;a, const T &amp;b)</div><div class="ttdoc">返回两者较小者</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00009">Algorithm.h:9</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_aa69d6a2300c1f391347658986741d8a8"><div class="ttname"><a href="_algorithm_8h.html#aa69d6a2300c1f391347658986741d8a8">seq_erase</a></div><div class="ttdeci">Cont::iterator seq_erase(Cont &amp;c, const Value &amp;val)</div><div class="ttdoc">从序列容器中删除一个元素</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00234">Algorithm.h:234</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_a9379b0bfedc56fbe48ad3e07b67273ee"><div class="ttname"><a href="_algorithm_8h.html#a9379b0bfedc56fbe48ad3e07b67273ee">qmax</a></div><div class="ttdeci">const T &amp; qmax(const T &amp;a, const T &amp;b)</div><div class="ttdoc">返回两者较大者</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00015">Algorithm.h:15</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_aa47ac809a299b50f2a7056d5b4f0a68b"><div class="ttname"><a href="_algorithm_8h.html#aa47ac809a299b50f2a7056d5b4f0a68b">find_first_not_of</a></div><div class="ttdeci">Iterator find_first_not_of(Iterator first, Iterator last, ValueType val)</div><div class="ttdoc">查找第一个不为val的字符所在位置</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00179">Algorithm.h:179</a></div></div>
<div class="ttc" id="a_algorithm_8h_html_a06f9a9fa653c88f36445cacf0ea7ad8d"><div class="ttname"><a href="_algorithm_8h.html#a06f9a9fa653c88f36445cacf0ea7ad8d">copy_seq</a></div><div class="ttdeci">size_t copy_seq(Value1 *v1, size_t s1, const Value2 *v2, size_t s2)</div><div class="ttdoc">拷贝序列2中的值到序列1中</div><div class="ttdef"><b>Definition:</b> <a href="_algorithm_8h_source.html#l00053">Algorithm.h:53</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
